473,420 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,420 software developers and data experts.

FCKeditor disabling toolbar items

69
Hi,

Probably not a great place for this post, but FCKeditor is very well used so hopefully someone can help.

Basically I have a form with two buttons - an edit button that creates an FCKeditor instance and creates a dynamic save function and a save button that needs to do some Javascript stuff before submitting the form. The save stuff looks like this.


Expand|Select|Wrap|Line Numbers
  1. function doSave()
  2. {
  3.       ....
  4.       ....
  5.       ....
  6.       document.managePagesForm.submit();
  7. }
  8.  
  9. function FCKeditor_OnComplete( editorInstance )
  10. {
  11.    editorInstance.LinkedField.form.onsubmit = doSave;
  12. }
  13.  
Problem I have is that
Expand|Select|Wrap|Line Numbers
  1. document.managePagesForm.submit();
doesn't do anything because of the save function, but if I make my save button of type submit instead of type button it won't do the Javascript stuff I need to do before submitting the form. Can I disable the save button or remove a FCKeditor instance dynamically after I have used it?

Thanks,

Sean
Sep 25 '07 #1
10 8509
dmjpro
2,476 2GB
Have a try with this :-)

Expand|Select|Wrap|Line Numbers
  1. function doSave()
  2. {
  3.       ....
  4.       ....
  5.       ....
  6.       document.managePagesForm.submit();
  7. }
  8.  
  9. function FCKeditor_OnComplete( editorInstance,button_name )
  10. {
  11.    editorInstance.LinkedField.form["button_name"].onclick = doSave;
  12. }
Here the button_name is ....
Expand|Select|Wrap|Line Numbers
  1. <input type = button value = "Save" name = "button_name">
  2.  
Good Luck.

Kind regards,
Dmjpro.
Sep 26 '07 #2
Sebarry
69
Hi,

Thanks for that. I've tried it but to no avail. Here's what I've tried.

Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Save Changes" id="button_name" name="button_name" onclick="javascript:submitForm()" />
  2.  
[/code]

Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3.       editorInstance.LinkedField.form["button_name"].onclick = doSave;
  4. }
  5.  
  6. function doSave()
  7. {
  8.     // Do stuff to getHtml from FCKeditor and update form
  9. }
  10.  
  11. function submitForm()
  12. {
  13.     // Write contents of DIVs to hidden input fields.
  14.    document.form.submit();
  15. }
  16.  
  17.  
With the code you gave me how is "button_name" passed to
Expand|Select|Wrap|Line Numbers
  1. FCKeditor_OnComplete
? Should "button_name" be in quotes if it is passed as a parameter? What needs to happen is that the save button on the form (what I have called button_name) calls the submitForm function to submit the form and the save button in my FCKeditor instance calls the doSave function. Do you know where I can find the API documentation for FCKeditor? I would like to remove the instance once I'm finished with it. Do you know how to do that too?

Sorry for the million and one questions.

Thanks,

Sean

Have a try with this :-)

Expand|Select|Wrap|Line Numbers
  1. function doSave()
  2. {
  3.       ....
  4.       ....
  5.       ....
  6.       document.managePagesForm.submit();
  7. }
  8.  
  9. function FCKeditor_OnComplete( editorInstance,button_name )
  10. {
  11.    editorInstance.LinkedField.form["button_name"].onclick = doSave;
  12. }
Here the button_name is ....
Expand|Select|Wrap|Line Numbers
  1. <input type = button value = "Save" name = "button_name">
  2.  
Good Luck.

Kind regards,
Dmjpro.
Sep 26 '07 #3
dmjpro
2,476 2GB
Hi,

Thanks for that. I've tried it but to no avail. Here's what I've tried.

Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Save Changes" id="button_name" name="button_name" onclick="javascript:submitForm()" />
  2.  
[/code]

Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3.       editorInstance.LinkedField.form["button_name"].onclick = doSave;
  4. }
  5.  
  6. function doSave()
  7. {
  8.     // Do stuff to getHtml from FCKeditor and update form
  9. }
  10.  
  11. function submitForm()
  12. {
  13.     // Write contents of DIVs to hidden input fields.
  14.    document.form.submit();
  15. }
  16.  
  17.  
With the code you gave me how is "button_name" passed to
Expand|Select|Wrap|Line Numbers
  1. FCKeditor_OnComplete
? Should "button_name" be in quotes if it is passed as a parameter? What needs to happen is that the save button on the form (what I have called button_name) calls the submitForm function to submit the form and the save button in my FCKeditor instance calls the doSave function. Do you know where I can find the API documentation for FCKeditor? I would like to remove the instance once I'm finished with it. Do you know how to do that too?

Sorry for the million and one questions.

Thanks,

Sean
First tell me ....
Expand|Select|Wrap|Line Numbers
  1. editorInstance.LinkedField......
  2.  
Is editorInstance.LinkedField a reference to a document?

Kind regards,
Dmjpro.
Sep 27 '07 #4
Sebarry
69
editorInstance is a parameter passed to the On_Complete function. The rest I don't know, it's FCKeditor API syntax. I got the original code from http://wiki.fckeditor.net/Developer's_Guide/Javascript_API scroll to the bottom of the page.

First tell me ....
Expand|Select|Wrap|Line Numbers
  1. editorInstance.LinkedField......
  2.  
Is editorInstance.LinkedField a reference to a document?

Kind regards,
Dmjpro.
Sep 27 '07 #5
dmjpro
2,476 2GB
editorInstance is a parameter passed to the On_Complete function. The rest I don't know, it's FCKeditor API syntax. I got the original code from http://wiki.fckeditor.net/Developer's_Guide/Javascript_API scroll to the bottom of the page.
Have a try this!

Expand|Select|Wrap|Line Numbers
  1. <form name="form_name">
  2. <input type = button name="button_name" onclick = "javascript:submit()">
  3. </form>
  4.  
Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3. editorInstance.LinkedField.forms["form_name"].elements["button_name"].onclick = doSave;
  4. }
  5.  
Kind regards,
Dmjpro.
Sep 27 '07 #6
Sebarry
69
I'm a bit confused here, because the syntax seems to suggest that it is trying to link the save button on the form to the doSave Javascript function. I want to link the save button on the FCKeditor to the doSave Javascript function. The save button on the HTML form should do the Javascript submit stuff.

Have a try this!

Expand|Select|Wrap|Line Numbers
  1. <form name="form_name">
  2. <input type = button name="button_name" onclick = "javascript:submit()">
  3. </form>
  4.  
Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3. editorInstance.LinkedField.forms["form_name"].elements["button_name"].onclick = doSave;
  4. }
  5.  
Kind regards,
Dmjpro.
Sep 27 '07 #7
dmjpro
2,476 2GB
I'm a bit confused here, because the syntax seems to suggest that it is trying to link the save button on the form to the doSave Javascript function. I want to link the save button on the FCKeditor to the doSave Javascript function. The save button on the HTML form should do the Javascript submit stuff.
Can you Post some code, from where I can figure out when FCKeditor_OnComplete function is called and the line editorInstance.LinkedField.....
And tell me something what you need and what is happening.
Ok!

Kind regards,
Dmjpro.
Sep 27 '07 #8
Sebarry
69
Okie Dokies. Here we go.

Expand|Select|Wrap|Line Numbers
  1. function editSection(divId) 
  2. {
  3.       var fck = new FCKeditor( "myFCKeditor" );
  4.       fck.BasePath = '/iwo/FCKeditor/';
  5.       fck.Value = divContent.innerHTML;
  6.       fck.ToolbarSet = 'Basic';
  7.       alert( "Creating FCK" );
  8.       divContent.innerHTML = fck.CreateHtml();
  9. }
  10.  
  11. function doSave()
  12. {
  13.       alert( "Saving" );
  14.       var editor = FCKeditorAPI.GetInstance( "myFCKeditor" );
  15.       contentDiv.innerHTML = editor.GetHTML();
  16. }
  17.  
  18. function submitForm()
  19. {
  20.       alert( "Submitting" );
  21.       // Processing code goes here.    
  22.       document.managePagesForm.submit();
  23. }
  24.  
  25. function FCKeditor_OnComplete( editorInstance )
  26. {
  27. editorInstance.LinkedField.forms["managePagesForm"].elements["button_name"].onclick = doSave;
  28. }
  29.  
Expand|Select|Wrap|Line Numbers
  1. ....
  2. ....
  3. <input type="button" value="Save Changes" id="button_name" name="button_name" onclick="javascript:submitForm()" />
  4. ...
  5. ....
  6.  
The javascript function
Expand|Select|Wrap|Line Numbers
  1. editSection
is called when an edit button is clicked. This creates a FCKeditor instance (FCKeditor.net) and on completion of the instance creation the
Expand|Select|Wrap|Line Numbers
  1. FCKeditor_OnComplete
function is called. In this function I need to associate the save button from FCKeditor, not on my HTML form, with the doSave function that I have written. In other words, the doSave function should be called when the save button in FCKeditor is clicked. The submitForm function should be called when the "Save Changes" button in the HTML form is clicked.

Hope that helps.

Sean
Sep 27 '07 #9
dmjpro
2,476 2GB
Okie Dokies. Here we go.

Expand|Select|Wrap|Line Numbers
  1. function editSection(divId) 
  2. {
  3.       var fck = new FCKeditor( "myFCKeditor" );
  4.       fck.BasePath = '/iwo/FCKeditor/';
  5.       fck.Value = divContent.innerHTML;
  6.       fck.ToolbarSet = 'Basic';
  7.       alert( "Creating FCK" );
  8.       divContent.innerHTML = fck.CreateHtml();
  9. }
  10.  
  11. function doSave()
  12. {
  13.       alert( "Saving" );
  14.       var editor = FCKeditorAPI.GetInstance( "myFCKeditor" );
  15.       contentDiv.innerHTML = editor.GetHTML();
  16. }
  17.  
  18. function submitForm()
  19. {
  20.       alert( "Submitting" );
  21.       // Processing code goes here.    
  22.       document.managePagesForm.submit();
  23. }
  24.  
  25. function FCKeditor_OnComplete( editorInstance )
  26. {
  27. editorInstance.LinkedField.forms["managePagesForm"].elements["button_name"].onclick = doSave;
  28. }
  29.  
Expand|Select|Wrap|Line Numbers
  1. ....
  2. ....
  3. <input type="button" value="Save Changes" id="button_name" name="button_name" onclick="javascript:submitForm()" />
  4. ...
  5. ....
  6.  
The javascript function
Expand|Select|Wrap|Line Numbers
  1. editSection
is called when an edit button is clicked. This creates a FCKeditor instance (FCKeditor.net) and on completion of the instance creation the
Expand|Select|Wrap|Line Numbers
  1. FCKeditor_OnComplete
function is called. In this function I need to associate the save button from FCKeditor, not on my HTML form, with the doSave function that I have written. In other words, the doSave function should be called when the save button in FCKeditor is clicked. The submitForm function should be called when the "Save Changes" button in the HTML form is clicked.

Hope that helps.

Sean
Ok!
Try this one ...
Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3. editorInstance.LinkedField.forms["managePagesForm"].elements["button_name"].setAttribute("onclick",doSave);
  4. }
  5.  
Good Luck :-)

Kind regards,
Dmjpro.
Sep 27 '07 #10
Sebarry
69
Nah that's still not going to work. The line
Expand|Select|Wrap|Line Numbers
  1. editorInstance.LinkedField.forms["managePagesForm"].elements["button_name"].setAttribute("onclick",doSave);
needs to be of FCKeditor syntax, not Javascript. It needs to link the save button in FCKeditor to the doSave function, not the save button on my HTML form.

Ok!
Try this one ...
Expand|Select|Wrap|Line Numbers
  1. function FCKeditor_OnComplete( editorInstance )
  2. {
  3. editorInstance.LinkedField.forms["managePagesForm"].elements["button_name"].setAttribute("onclick",doSave);
  4. }
  5.  
Good Luck :-)

Kind regards,
Dmjpro.
Sep 27 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nathan Bloom | last post by:
Hi, I was wondering if there was any way to disable certain menu items and toolbar icons at runtime using VBA? Particularly the delete icon on the tool bar and the delete option under edit. I...
1
by: R.Balaji | last post by:
Hi, We are developing a windows application using c#. We have created a toolbar with some toolbar buttons. When we disable the toolbar button, the toolbar button image should be displayed...
8
by: Ronald | last post by:
Hi, I'm am trying to implement FCKeditor in my webapplication, but unfortunatly, I haven't succeeded in doing this. After almost a week, I finally got an compiled application, but now I get some...
2
by: Curtis | last post by:
I have a toolbar and, at run time, putting on a dropdown control and adding items. All is ok, but I don't know how to catch the click event. The items are there on the drop down. They are...
6
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for...
4
by: Showjumper | last post by:
I was experimenting w/ Freetextbox. One thing i noticed w/ FTB was that when you look at the html source generated by FTB its not xhtml i.e. the tags are uppercased. I just saw on the FTB forums...
5
by: Jeff | last post by:
Hey ASP.NET 2.0 lets say I have a web page containing a FCKeditor, when this page loads it will fill the FCKeditor with some kind of text... I'm wondering how to set this text in the...
1
by: Archana1 | last post by:
hi I want to add fckeditor in asp. but it have some error like page can not be display Please reply urgently my code is: <!-- #include...
3
by: gleery | last post by:
We can add a caret in textarea, but when I inspect FCkEditor with firebug, I don't find a textarea tag, but still there is a caret there. I wonder how Fckeditor do that? Anyone know that?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.